package com.example.springmvcdemo4.mapper;

import com.example.springmvcdemo4.model.MessageInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MessageinfoMapper {
    //发布留言
    @Insert("insert into message_info (`from`,`to`,message) " +
            "values (#{messageinfo.from},#{messageinfo.to},#{messageinfo.message});")
    Integer insertMessage(@Param("messageinfo") MessageInfo messageInfo);

    //查询留言
    @Select("select * from message_info where delete_flag = 0")
    List<MessageInfo> selectAllList();
}
